package com.bigShen.pattern.singleton.seri;

import java.io.Serializable;

/**
 * @Auther: lei.shen
 * @Date: 2018/10/1 17:12
 * @Description:
 */
public class SerializeDemo implements Serializable {

    private static final SerializeDemo INSTANCE = new SerializeDemo();

    private SerializeDemo() {

    }

    public static SerializeDemo getInstance() {
        return INSTANCE;
    }

    // 定义 readResolve 方法, 反序列化时，可以恢复到原有的单例对象
    public Object readResolve() {
        return INSTANCE;
    }

}
